home *** CD-ROM | disk | FTP | other *** search
- -- this updates the high score field if the score field becomes greater,
- if the high score is always being displayed, you would want to call this
- everytime the score changes
- on Update_High_Score
- set high = integer(field "highscore")
- set curr = integer(field "scoreField")
- if (curr > high) then
- put curr into field "highscore"
- end if
- end
-
- -----------
- -- save high score
- -- this saves the high score to a file called robobhs.hsc in the OS
- directory. the OS directory is c:\windows\system on the PC and
- something similar on the MAC
- -- nothing is returned for OS dir in 3.1, so there is no high score
- saving with the 3.1 version of the game. this snippet of code should go
- in whatever handler is
- -- responsible for writing the high score to disk.
-
- set highFile = getosdirectory()&"robobhs.hsc"
- set myFile = new(xtra "FileIO")
- openFile (myFile, highFile, 2)
- writeString(myFile, field "highscore")
- closeFile(myFile)
-
- ----------------
- -- get high score stuff
- -- this is for reading the highscore file and putting the value into a
- field called highscore. this would most likely be placed in startMovie
-
- set highFile = getosdirectory()&"robobhs.hsc"
- set myFile = new(xtra "FileIO")
- openFile (myFile, highFile, 0)
- if (status(myFile) < 0) then
- closeFile(myFile)
- createFile(myFile, highFile)
- openFile (myFile, highFile, 0)
- end if
- set myString = readLine(myFile)
- if (getLength(myFile) = 0) then
- writeString myFile, "0"
- put "0" into field "highscore"
- else
- put myString into field "highscore"
- end if
- closeFile(myFile)
-